.class Lcom/burstly/lib/component/AdaptorController$ViewSwitcher;
.super Ljava/lang/Object;
.source "AdaptorController.java"

# interfaces
.implements Ljava/lang/Runnable;


# annotations
.annotation system Ldalvik/annotation/EnclosingClass;
    value = Lcom/burstly/lib/component/AdaptorController;
.end annotation

.annotation system Ldalvik/annotation/InnerClass;
    accessFlags = 0xa
    name = "ViewSwitcher"
.end annotation


# instance fields
.field private final mController:Ljava/lang/ref/Reference;
    .annotation system Ldalvik/annotation/Signature;
        value = {
            "Ljava/lang/ref/Reference",
            "<",
            "Lcom/burstly/lib/component/AdaptorController;",
            ">;"
        }
    .end annotation
.end field


# direct methods
.method constructor <init>(Lcom/burstly/lib/component/AdaptorController;)V
    .locals 1
    .parameter "controller"

    .prologue
    .line 409
    invoke-direct {p0}, Ljava/lang/Object;-><init>()V

    .line 410
    new-instance v0, Ljava/lang/ref/WeakReference;

    invoke-direct {v0, p1}, Ljava/lang/ref/WeakReference;-><init>(Ljava/lang/Object;)V

    iput-object v0, p0, Lcom/burstly/lib/component/AdaptorController$ViewSwitcher;->mController:Ljava/lang/ref/Reference;

    .line 411
    return-void
.end method


# virtual methods
.method public run()V
    .locals 9

    .prologue
    const/4 v8, -0x2

    .line 415
    iget-object v7, p0, Lcom/burstly/lib/component/AdaptorController$ViewSwitcher;->mController:Ljava/lang/ref/Reference;

    invoke-virtual {v7}, Ljava/lang/ref/Reference;->get()Ljava/lang/Object;

    move-result-object v2

    check-cast v2, Lcom/burstly/lib/component/AdaptorController;

    .line 416
    .local v2, controller:Lcom/burstly/lib/component/AdaptorController;
    if-eqz v2, :cond_0

    iget-boolean v7, v2, Lcom/burstly/lib/component/AdaptorController;->mDestroyed:Z

    if-eqz v7, :cond_1

    .line 439
    :cond_0
    :goto_0
    return-void

    .line 419
    :cond_1
    #getter for: Lcom/burstly/lib/component/AdaptorController;->mViewHolder:Lcom/burstly/lib/component/ViewHolder;
    invoke-static {v2}, Lcom/burstly/lib/component/AdaptorController;->access$000(Lcom/burstly/lib/component/AdaptorController;)Lcom/burstly/lib/component/ViewHolder;

    move-result-object v6

    .line 420
    .local v6, viewHolder:Lcom/burstly/lib/component/ViewHolder;
    invoke-virtual {v6}, Lcom/burstly/lib/component/ViewHolder;->getPrecachedAdView()Landroid/view/View;

    move-result-object v5

    .line 421
    .local v5, precachedView:Landroid/view/View;
    invoke-virtual {v6}, Lcom/burstly/lib/component/ViewHolder;->getAdView()Landroid/view/View;

    move-result-object v1

    .line 423
    .local v1, adView:Landroid/view/View;
    if-eqz v5, :cond_4

    move-object v0, v5

    .line 424
    .local v0, activeView:Landroid/view/View;
    :goto_1
    if-eqz v0, :cond_3

    .line 425
    invoke-virtual {v2}, Lcom/burstly/lib/component/AdaptorController;->hideComponent()V

    move-object v4, v0

    .line 426
    check-cast v4, Lcom/burstly/lib/component/networkcomponent/HierarchyAwareLayout;

    .line 427
    .local v4, layout:Lcom/burstly/lib/component/networkcomponent/HierarchyAwareLayout;
    invoke-virtual {v2}, Lcom/burstly/lib/component/AdaptorController;->isDebugGestureOn()Z

    move-result v7

    if-eqz v7, :cond_2

    .line 428
    const/4 v7, 0x1

    invoke-virtual {v4, v7}, Lcom/burstly/lib/component/networkcomponent/HierarchyAwareLayout;->setIsDebugGestureOn(Z)V

    .line 429
    new-instance v3, Lcom/burstly/lib/component/DebugView;

    invoke-virtual {v4}, Lcom/burstly/lib/component/networkcomponent/HierarchyAwareLayout;->getContext()Landroid/content/Context;

    move-result-object v7

    invoke-direct {v3, v7, v2}, Lcom/burstly/lib/component/DebugView;-><init>(Landroid/content/Context;Lcom/burstly/lib/component/AdaptorController;)V

    .line 430
    .local v3, debugView:Lcom/burstly/lib/component/DebugView;
    const/16 v7, 0x8

    invoke-virtual {v3, v7}, Lcom/burstly/lib/component/DebugView;->setVisibility(I)V

    .line 431
    new-instance v7, Landroid/widget/FrameLayout$LayoutParams;

    invoke-direct {v7, v8, v8}, Landroid/widget/FrameLayout$LayoutParams;-><init>(II)V

    invoke-virtual {v3, v7}, Lcom/burstly/lib/component/DebugView;->setLayoutParams(Landroid/view/ViewGroup$LayoutParams;)V

    .line 433
    invoke-virtual {v4, v3}, Lcom/burstly/lib/component/networkcomponent/HierarchyAwareLayout;->addDebugView(Landroid/view/View;)V

    .line 435
    .end local v3           #debugView:Lcom/burstly/lib/component/DebugView;
    :cond_2
    invoke-virtual {v2, v4}, Lcom/burstly/lib/component/AdaptorController;->addComponentToParent(Landroid/view/View;)V

    .line 436
    invoke-virtual {v6, v0}, Lcom/burstly/lib/component/ViewHolder;->setAdView(Landroid/view/View;)V

    .line 438
    .end local v4           #layout:Lcom/burstly/lib/component/networkcomponent/HierarchyAwareLayout;
    :cond_3
    const/4 v7, 0x0

    invoke-virtual {v6, v7}, Lcom/burstly/lib/component/ViewHolder;->setPrecachedAdView(Landroid/view/View;)V

    goto :goto_0

    .end local v0           #activeView:Landroid/view/View;
    :cond_4
    move-object v0, v1

    .line 423
    goto :goto_1
.end method
